package hl.fildir;

import java.io.*;
import java.util.Scanner;

public class ReDirect {

    public static void main(String[] args){

        try (var fis = new FileInputStream("hello.txt");
             var fos = new PrintStream(new FileOutputStream("FileOutputStream.java")) )
        {
            System.setIn(fis);
            System.setOut(fos);
            System.setErr(fos);

            var sc = new Scanner(System.in);
            sc.useDelimiter("\r\n");
            while (sc.hasNext()){
                System.out.println(sc.next());
            }
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}
